<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="app" uri="/application" %>
<%@ taglib  prefix="s"  uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link href="/css/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="all_main">
  <div class="head_main">
    <div class="main_nav">cpa效果报表</div>
    <div class="main_soso">
    <form action="/campaign/excel_down.shtml">
    	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
		    <td width="19" height="30" align="center"><img src="../images/clean_011.gif" width="16" height="16" /></td>
		    <td>
		   packId：<input  class="inputwidth01" type="text" maxlength="50"  onkeypress="util.justNum([44]);" style="width:180px;" value="${packIds}" name="packIds">
		   channelId：<input  class="inputwidth01" type="text" maxlength="50"  onkeypress="util.justNum([]);" style="width:80px;" value="${channelId}" name="channelId">
		      开始时间:
		      <input name="beginDate" value="<fmt:formatDate value="${beginDate}" pattern="yyyy-MM-dd"/>" type="text" class="date_type" id="textfield" readonly="readonly"  onclick="new Calendar().show(this);"/>
		       结束时间: 
		      <input name="endDate" value="<fmt:formatDate value="${endDate}" pattern="yyyy-MM-dd"/>" type="text" class="date_type" id="textfield" readonly="readonly"  onclick="new Calendar().show(this);"/>

		      </td>
		    <td align="left">
		      <input name="input7" type="button" onclick="_submit(this,'/campaign/search_pack_report_date.shtml')" class="input01" value="搜索" />
		      &nbsp;<input name="input7" type="button" onclick="_submit(this,'/campaign/excel_down.shtml')" class="input01" value="下载excel文件" />
		      </td>
		  </tr>
		</table>
    </form>
    </div>
    <div class="main_title">
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <th width="15%">产品</th>
          <th width="10%">时间</th>
          <th width="10%">效果数</th>
          <th width="10%">结算数 </th>
          <th width="10%">接入价</th>
          <th width="10%">投放价 </th>
          <th width="10%">收入金额</th>
          <th width="10%">支出金额</th>
          <th width="10%">毛利</th>
          <th>渠道id</th>
        </tr>
      </table>
    </div>
  </div>
  <div class="content_main">
    <table border="0" cellpadding="0" cellspacing="0" width="100%" id="background_hegh01">
      <tbody class="split">
      <c:forEach items="${list}" var="pack">
		     <c:forEach items="${pack.list}" var="o" varStatus="index">
		         <c:choose>
		           <c:when test="${index.first}">
			           <tr>
				         <td width="15%" rowspan="${fn:length(pack.list)}">${o[1]} (${o[0]}-${o[10]})</td>
				         <td width="10%">${o[2]}</td>
				         <td width="10%">${o[3]}</td>
				         <td width="10%">${o[4]}</td>
				         <td width="10%">${o[5]}</td>
				         <td width="10%">${o[6]}</td>
				         <td width="10%">${o[7]}</td>
				         <td width="10%">${o[8]}</td>
				         <td width="10%">${o[9]}</td>
				         <td >${o[10]}</td>
				         </tr>
		           </c:when>
		           <c:otherwise>
		           <tr>
				         <td width="10%">${o[2]}</td>
				         <td width="10%">${o[3]}</td>
				         <td width="10%">${o[4]}</td>
				         <td width="10%">${o[5]}</td>
				         <td width="10%">${o[6]}</td>
				         <td width="10%">${o[7]}</td>
				         <td width="10%">${o[8]}</td>
				         <td width="10%">${o[9]}</td>
				         <td >${o[10]}</td>
				     </tr>
		           </c:otherwise>
		         </c:choose>
		     </c:forEach>
		     
		     <tr style="background: #ffcccc;">
		         <td width="10%" colspan="2">小计</td>
		         <td width="10%">${pack.sumActionCount}</td>
		         <td width="10%">${pack.sumFactCount}</td>
		         <td width="10%">--</td>
		         <td width="10%">--</td>
		         <td width="10%"><fmt:formatNumber value="${pack.getMoney}" pattern="#0.00"></fmt:formatNumber></td>
		         <td width="10%"><fmt:formatNumber value="${pack.payMoney}" pattern="#0.00"></fmt:formatNumber></td>
		         <td width="10%"><fmt:formatNumber value="${pack.profit}" pattern="#0.00"></fmt:formatNumber></td>
		         <td >&nbsp;</td>
	         </tr>
      </c:forEach>
      <tr style="background: #ff6666;">
		         <td width="10%" colspan="2">总计</td>
		         <td width="10%">${rb.totalActionCount}</td>
		         <td width="10%">${pack.totalFactCount}</td>
		         <td width="10%">--</td>
		         <td width="10%">--</td>
		         <td width="10%"><fmt:formatNumber value="${rb.totalGetMoney}" pattern="#0.00"></fmt:formatNumber></td>
		         <td width="10%"><fmt:formatNumber value="${rb.totalPayMoney}" pattern="#0.00"></fmt:formatNumber></td>
		         <td width="10%"><fmt:formatNumber value="${rb.totalProfit}" pattern="#0.00"></fmt:formatNumber></td>
		         <td >&nbsp;</td>
	         </tr>
      </tbody>
    </table>
  </div>
  
  <app:page></app:page>
</div>
</body>
</html>
<script type="text/javascript"  src="/scripts/util.js"></script>
<script  src="/scripts/util.js" type="text/javascript"></script>
<script type="text/javascript" src="/scripts/calendar.js"></script>
<script type="text/javascript">
  
     function _submit(th,ac){
    	 th.form.action=ac;
    	 th.form.submit();
     }

     

</script>